package com.kui.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kui.model.dto.user.LoginRequest;
import com.kui.model.dto.user.RegisterRequest;
import com.kui.model.dto.user.UserQueryRequest;
import com.kui.model.entity.User;
import com.kui.model.vo.LoginUserVO;
import com.kui.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author lack
 * @description 针对表【user(用户表)】的数据库操作Service
 * @createDate 2025-01-19 14:43:09
 */

public interface UserService extends IService<User> {
    /**
     * 用户注册
     *
     * @param registerRequest
     * @return
     */
    Long userRegister(RegisterRequest registerRequest);

    /**
     * 用户登录
     *
     * @param loginRequest
     * @param request
     * @return
     */
    LoginUserVO userLogin(LoginRequest loginRequest, HttpServletRequest request);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 登出
     *
     * @param request
     * @return
     */
    Boolean loginOut(HttpServletRequest request);

    /**
     * 密码加密
     *
     * @param password
     * @return
     */
    String encryptPassword(String password);

    /**
     * 脱敏
     *
     * @param user
     * @return
     */
    LoginUserVO loginUser(User user);

    /**
     * 获取脱敏用户信息
     *
     * @param user
     * @return
     */
    UserVO getUserVO(User user);

    /**
     * 获取脱敏用户列表
     *
     * @param userList
     * @return
     */
    List<UserVO> getUserList(List<User> userList);

    /**
     * 获取查询条件
     *
     * @param userQueryRequest
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    /**
     * 判断是否为管理员
     *
     * @param user
     * @return
     */
    boolean isAdmin(User user);
}
